package chapter5.eg4;

import java.util.concurrent.TimeUnit;

public class Main {

  public static void main(String[] args) throws InterruptedException {
    String topic = "test-topic";
    String groupId = "test-group";
    final ConsumerThreadHandler<byte[], byte[]> handler = new ConsumerThreadHandler<>(groupId, topic);
    final int cpuCount = Runtime.getRuntime().availableProcessors();
    new Thread(() -> handler.connsume(cpuCount)).start();
    TimeUnit.SECONDS.sleep(20000L);
    System.out.println("Starting to close the consumer...");
    handler.close();
  }
}
